﻿using XTeam.Document.Services;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System;
using XTeam.Document.Entities;
using System.Collections.Generic;
using System.Configuration;
using XTeam.Core.Interface;
using XTeam.Core.Helper;

namespace XTeam.Documents.UnitTest
{



    [TestClass()]
    [DeploymentItem("../../../xTeam.XDocuments.ObjectBuilder/bin/Debug")]
    public class ArticleClassifyServiceTest
    {

        public ArticleClassifyServiceTest()
        {
        }

        /// <summary>
        /// 增加
        /// </summary>
        [TestMethod()]
        public void AppendTest()
        {
            ArticleClassifyService target = new ArticleClassifyService();
            IList<ArticleClassifyEntity> entities = new ArticleClassifyEntity[] {
               new ArticleClassifyEntity()
               {
                   ClassName = "测试",
                   ParentId = 0
               },
            };
            int actual = target.Append(entities);

        }

        /// <summary>
        /// 删除
        /// </summary>
        [TestMethod()]
        public void DeleteTest()
        {
            ArticleClassifyService target = new ArticleClassifyService();
            IList<int> ids = null;
            int actual = target.Delete(ids);

        }



        /// <summary>
        /// 查找
        /// </summary>
        [TestMethod()]
        public void FindTest()
        {
            ArticleClassifyService target = new ArticleClassifyService();
            int classId = 1;
            ArticleClassifyEntity actual = target.Find(classId);

        }

        /// <summary>
        /// 搜索
        /// </summary>
        [TestMethod()]
        public void SearchTest()
        {
            ArticleClassifyService target = new ArticleClassifyService();
            Func<ArticleClassifyEntity, bool> filter = null;
            IList<ArticleClassifyEntity> actual = target.Search(filter);


            ArticleClassifyEntity root = new ArticleClassifyEntity();
            root.ClassId = 0;
            TreeBuilder<ArticleClassifyEntity> tree = new TreeBuilder<ArticleClassifyEntity>(root);
            tree.Builder(actual);

            target.Update(actual);



        }

        /// <summary>
        /// 更新
        /// </summary>
        [TestMethod()]
        public void UpdateTest()
        {
            ArticleClassifyService target = new ArticleClassifyService();
            IList<ArticleClassifyEntity> entities = new List<ArticleClassifyEntity>();
            entities.Add(new ArticleClassifyEntity()
            {
                ClassId = 1,
                ClassName = string.Format("{0}", DateTime.Now),
                Floor = new Random().Next(1, 10)
            });
            int actual = target.Update(entities);

        }

    }
}
